package org.bwapi.bridge.model;

import java.util.HashMap;
import java.util.Map;

/**
 * BWAPI enumerate. Simply returns the underlying ordinal 
 * that BWAPI uses
 * 
 * @author Chad Retz
 */
public interface BwapiEnumerate {

	int getBwapiOrdinal();
	
	static class Builder{
		public static <T extends Enum<T> & BwapiEnumerate> Map<Integer, T> buildMap(
				T[] values) {
			Map<Integer, T> ret = new HashMap<Integer, T>(values.length);
			for (T value : values) {
				ret.put(value.getBwapiOrdinal(), value);
			}
			return ret;
		}
	}
}
